import HTTP from '../http.js'
const ERR_OK = 200
class classAPi extends HTTP{
    constructor() {
        super()
    }
    getProAndPreList({ type='', keyword='', page='' }) {
        return this.request({
            url: '/home/course/index',
            method: 'get',
            data: { type, keyword, page }
        })
        .then(res => {
            if (res.code === ERR_OK) {
                return Promise.resolve(res.data)
            }
        })
        .catch(err => {
            return Promise.reject(err)
        })
    }
    getSwiperList() {
        return new Promise((resolve, reject) => {
            this.request({
                url: '/home/course/getCourseBanner',
                method: 'get'
            })
            .then(res => {
                if (res.code === ERR_OK) {
                    resolve(res.data)                    
                }
            })
            .catch(err => {
                console.log(err)
                reject(err)
            })
        })
    }
    getPreClusterList() {
        return new Promise((resolve, reject) => {
            this.request({
                url: '/home/course/selectSpellGroup',
                method: 'get'
            })
            .then(res => {
                if (res.code === ERR_OK) {
                    resolve(res.data)
                }
            })
            .catch(err => {
                console.log(err)
            })
        })
    }
}
export  default classAPi 